<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<%-- The language chooser --%>
<div style="position:absolute; left:0; top:0; width:100%;">
  <div id="lang-chooser" class="popupList">
    <ul>
      <c:set var="curLang" value="${pageContext.response.locale.language}"/>

      <c:if test="${curLang != 'en' && curLang != 'es' && curLang != 'fr'}">
        <c:set var="curLang" value="en"/>
      </c:if>

      <%-- English --%>
      <c:if test="${curLang != 'en'}">
        <li><a href="javascript:setLang('en', pageReloadUrl);">
          <spring:theme code="lang.en"/></a></li>
      </c:if>

      <%-- French --%>
      <c:if test="${curLang != 'fr'}">
        <li><a href="javascript:setLang('fr', pageReloadUrl);">
          <spring:theme code="lang.fr"/></a></li>
      </c:if>
    </ul>
  </div>
</div>

<%--  The global javascript constant defining the url to use to
      modify the language.
      All pages that require a URL different from the page's one must set
      this variable in the page body (not here). --%>
<script type="text/javascript">
  var pageReloadUrl = "";
</script>

<a href="javascript:;" id="lang-chooser-link"
  onclick="showPopupList('lang-chooser-link', 'lang-chooser');">
  <spring:theme code='lang.${curLang}' />
</a>